<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>修改密码 - Powered By ${systemConfig.systemName}</title>
<meta name="Author" content="E-SHOP Team" />
<meta name="Copyright" content="E-SHOP" />
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link href="${base}/res/css/common.css" rel="stylesheet" type="text/css" />
<% include("/WEB-INF/views/common/include.html"){}%>
<script type="text/javascript" src="${base}/res/plugins/hplus/js/plugins/layer/layer.min.js"></script>
</head>
<body class="memberCenter">
<div class="path">
    密码管理 &raquo; 修改密码
</div>
<form id="inputForm" class="validate" >
	<table class="input tabContent">
		<tr>
			<th>
				旧密码:
			</th>
			<td>
				<input type="password" name="oldPassword" class="formText" />
                <label class="requireField">*</label>
			</td>
		</tr>
		<tr>
			<th>
				新密码:
			</th>
			<td>
				<input type="password" name="password" class="formText" />
                <label class="requireField">*</label>
			</td>
		</tr>
		<tr>
			<th>
				确认新密码:
			</th>
			<td>
				<input type="password" name="surePassword" class="formText" />
                <label class="requireField">*</label>
			</td>
		</tr>
		<tr>
			<th>
				头像:
			</th>
			<td>
				<div id="image_upload" class="">
					<img class="img-rounded" style="max-height:50px;" src="${member.userimgurl!}"/>
					<input type="hidden" name="userimgurl" value="${member.userimgurl!}" class=" pull-left form-control input-sm" />
					<input type="button" class="button browserButton" value="选择文件" />
				</div>
			</td>
		</tr>
	</table>
	<div class="buttonArea" style="margin-left: 165px;margin-top: 5px;">
		<input type="" readonly class="button" id="button" value="提 交" hidefocus="true" style="text-align: center;"/>
	</div>
</form>


</body>
<!-- 自定义js -->
<script src="https://static.9hive.cn/global/vendor/inside/inside20170925.js"></script>
<script src="https://static.9hive.cn/global/vendor/file/uploadify/jquery_uploadify.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-ui/jquery-ui.min.js"></script>
<script type="text/javascript">
    var uploadUrl="/file/uploadfile?shopId=${shopId!}&type=d";
    var browserUrl="/file/browser?shopId=${shopId!}";
</script>
<script src="https://static.9hive.cn/global/vendor/file/file.js"></script>
<script type="text/javascript">
    $(function () {
        $("input.browserButton").browser();
    })
</script>
<script>
	$("#button").click(function () {
        var oldPassword=$("input[name='oldPassword']").val();
        var password=$("input[name='password']").val();
        var surePassword=$("input[name='surePassword']").val();
        var userimgurl=$("input[name='userimgurl']").val();
		if(!oldPassword){
            layer.msg("旧密码不允许为空");
			return;
		}
        if(!password){
            layer.msg("新密码不允许为空");
            return;
        }
		if(password.length<4){
            layer.msg("密码长度不能小于4位数!");
            return;
		}
        if(!surePassword){
            layer.msg("确认新密码不允许为空");
            return;
        }
		if(password!=surePassword){
            layer.msg("新密码和确认新密码不一致");
            return;
		}

        $.ajax({
            url: "/password/update",
            type: 'GET',
            data:{
                "oldPassword":oldPassword,
                "password":password,
                "surePassword":surePassword,
				"userimgurl":userimgurl
            },
            success: function(data){
                if(data.code == 1){
                    layer.msg(data.desc);
                }else if (data.code == 0){
                    layer.msg('恭喜您修改成功');
                    window.location.reload();

                }
            }});
    });
</script>
</html>